sorting materials into groups